package com.example.recyclerviewcontextmenudemo;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.recyclerviewcontextmenudemo.dataoop.Book;

public class BookDetailsActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_book_details);

        TextView tvName = findViewById(R.id.tv_book_name);
        TextView tvPrice = findViewById(R.id.tv_book_price);
        ImageView ivBook = findViewById(R.id.iv_book_detail);

        Book book = (Book) getIntent().getSerializableExtra("book_data");
        if (book != null) {
            tvName.setText(book.getName());
            tvPrice.setText("价格：" + book.getPrice() + "元");
            ivBook.setImageResource(book.getImageResId());
        }
    }
}